package com.harry.feignconsumer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Harry
 * @date 2018/3/28 17:10
 */
@RestController
public class ConsumerController {


    @Autowired
    HelloService helloService;

    @Autowired
    RefactorHelloService refactorHelloService;

    @RequestMapping(value = "/feign-consumer3",method = RequestMethod.GET)
    public String consumer3(){

        StringBuilder sb = new StringBuilder();
        sb.append(refactorHelloService.hello("HARRY")).append("\n");
        sb.append(refactorHelloService.hello("HARRY",27)).append("\n");
        sb.append(refactorHelloService.hello(new com.harry.helloserviceapi.dto.User("Harry",27))).append("\n");

        return sb.toString();
    }


    @RequestMapping(value = "/feign-consumer2",method = RequestMethod.GET)
    public String helloConsumer2(){

        StringBuilder sb = new StringBuilder();
        sb.append(helloService.hello()).append("\n");
        sb.append(helloService.hello("HARRY")).append("\n");
        sb.append(helloService.hello("HARRY",27)).append("\n");
        sb.append(helloService.hello(new User("Harry",27))).append("\n");

        return sb.toString();
    }


    @RequestMapping(value = "/feign-consumer",method = RequestMethod.GET)
    public String helloConsumer(){
        return helloService.hello();
    }
}
